use ${newdata}carownership_dataset_bergen, clear

drop if year < 2011
drop if $trmgroup == . | $trmgroup == 0	
drop if couple == . | age == . | kvinne == . | children == . | antpers_i_regstat_famnr == . | secondhome == . | dist== . | time_work == . | employed == . | retired == . | wies == . | wealth == . | PublicVSCarTime_fam_mean == . | PublicDiffCarTime_fam_mean == . | max_educ == .

collapse (mean) bev cars ice, by($trmgroup year)
twoway (line bev year if $trmgroup == 1, lcolor(black) lpattern(solid)) ///
	(line bev year if $trmgroup == 2, lcolor(black) lpattern(dash)) ///
	(line bev year if $trmgroup == 3, lcolor(gs10) lpattern(solid)) ///
	(line bev year if $trmgroup == 4, lcolor(gs10) lpattern(dash)) ///
	, legend( order(1 3 2 4) ///
	lab (1 "Bergen, paying commuter") ///
	lab(2 "Bergen, non-paying commuter") ///
	lab(3 "Other cities, paying commuter") ///
	lab(4 "Other cities, non-paying commuter") pos(6) cols(2)) ///
	graphregion(color(white)) xtitle("") xlabel(2011(1)2017) ///
	name(g1, replace) ytitle("Electric vehicle share") scale(0.9)
graph export "${figures}fig2.png", as(png) replace
graph export "${figures}fig2.pdf", as(pdf) replace
